<?php
/**
 * Created by PhpStorm.
 * User: 庆金
 * Date: 2019-12-13
 * Time: 22:03
 */

/**
 * 读取文件
 * __DIR__
 * 异步回调模块已过时 请,,,swoole4以上的朋友 ,使用这个函数的朋友点击Coroutine->第一个Coroutine->Coroutine::readFile
 */
//swoole_async_readfile(__DIR__."1.txt",function ($filename,$filecontent){
//    echo "filename: ".$filename.PHP_EOL;
//    echo "content:".$filecontent.PHP_EOL;
//});

use Swoole\Coroutine\System;
$filename = __DIR__ . "/1.txt";
go(function () use ($filename)
{
    $r =  System::readFile($filename);

    echo "filename: ".$filename.PHP_EOL;
    echo "content:".$r.PHP_EOL;
//    var_dump($r);
});
echo "start".PHP_EOL;